//
//  FindCollectionViewCell.m
//  A Learning Walk
//
//  Created by 张勇 on 16/6/14.
//  Copyright © 2016年 战斗民族. All rights reserved.
//

#import "FindCollectionViewCell.h"

#define Height self.frame.size.height
#define Width self.frame.size.width

@interface FindCollectionViewCell ()


@end

@implementation FindCollectionViewCell

-(void)dealloc{
    [_imageV release];
    [_titleLabel release];
    [_subTitleLabel release];
    [_iconImageV release];
    [_smallImageView release];
    [super dealloc];
}


-(instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;

}

-(void)createSubviews{

    self.imageV = [UIImageView new];
    self.imageV.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.imageV];
    
    self.smallImageView = [UIImageView new];
    self.smallImageView.backgroundColor = [UIColor clearColor];
    self.smallImageView.image = [UIImage imageNamed:@"find_album_play"];
    [self.contentView addSubview:self.smallImageView];
    
    self.titleLabel = [UILabel new];
    self.titleLabel.backgroundColor = [UIColor clearColor];
    self.titleLabel.font = [UIFont systemFontOfSize:12];
    self.titleLabel.numberOfLines = 2;
    [self.contentView addSubview:self.titleLabel];
    
    self.iconImageV = [UIImageView new];
    self.iconImageV.backgroundColor = [UIColor clearColor];
    self.iconImageV.image = [UIImage imageNamed:@"icon"];
    [self.contentView addSubview:self.iconImageV];
    
    self.subTitleLabel = [UILabel new];
    self.subTitleLabel.backgroundColor = [UIColor clearColor];
    self.subTitleLabel.font = [UIFont systemFontOfSize:11];
    self.subTitleLabel.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.subTitleLabel];


}

-(void)layoutSubviews{
    [super layoutSubviews];
    self.imageV.frame = CGRectMake(0, 0, Width, Height / 7 * 4);
    
    self.smallImageView.frame = CGRectMake(self.imageV.frame.size.width / 4 * 3, self.imageV.frame.size.height / 4 * 3, self.imageV.frame.size.width / 4 - 10, self.imageV.frame.size.width / 4 - 10);
    
    self.titleLabel.frame = CGRectMake(0, Height / 7 * 4, Width, Height / 7 * 2);
    
    self.iconImageV.frame = CGRectMake(5, Height / 7 * 6 + 5, Height / 7 - 10, Height / 7 - 10);
    
    self.subTitleLabel.frame = CGRectMake(Height / 7, Height / 7 * 6, Width - (Height / 7), Height / 7);

}

@end



